n = int(input())
max = n
count = 1
while True:
    n = int(input())
    if n == 0:
        break
    if n>max:
        max = n
        count = 1
    elif n==max:
        count += 1
print(max)
print(count)
